cmake_minimum_required(VERSION 3.5)

project(xscript-porject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb -pg")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin)

include_directories(./include)
include_directories(./source)

add_library(
     xscript-core
     include/xscript/xdefs.h
     include/xscript/xfilereader.h
     source/xfilereader.cpp
     include/xscript/xlexer.h
     include/xscript/xtoken.h
     source/lexer/xtoken.cpp
     source/lexer/xlexer.cpp
     include/xscript/xvariabletable.h
     source/xvariabletable.cpp

     include/xscript/xprint.h
     source/xprint.cpp
     source/xerror.cpp

     include/xscript/xitemvisitor.h
     source/type/xitemvisitor.cpp

     include/xscript/xitem.h
     include/xscript/xitemtype.h
     include/xscript/xitemcontainer.h
     include/xscript/xitemsimpletype.h
     include/xscript/xitemundefined.h
     include/xscript/xitemboolean.h
     include/xscript/xitemstring.h
     include/xscript/xitemint32.h
     include/xscript/xitemint64.h
     include/xscript/xitemfloat.h
     include/xscript/xitemdouble.h
     include/xscript/xitemlist.h
     include/xscript/xitemdict.h
     include/xscript/xitemcontainer.h

     source/type/xitem.cpp
     source/type/xitemtype.cpp
     source/type/xitemundefined.cpp
     source/type/xitemboolean.cpp
     source/type/xitemstring.cpp
     source/type/xitemint32.cpp
     source/type/xitemint64.cpp
     source/type/xitemfloat.cpp
     source/type/xitemdouble.cpp
     source/type/xitemlist.cpp
     source/type/xitemdict.cpp
     source/type/xitemtoken.cpp
     source/type/xitemcontainer.cpp

     include/xscript/xscriptexecutor.h
     source/xscriptexecutor.cpp

     include/xscript/xmodule.h
     source/xmodule.cpp

     source/astree/xabstractsyntaxtreecreator_let.h
     source/astree/xabstractsyntaxtreecreator_let.cpp
     source/astree/xabstractsyntaxtreecreator_assign.h
     source/astree/xabstractsyntaxtreecreator_assign.cpp
     source/astree/xabstractsyntaxtreeparser.cpp
     source/astree/xabstractsyntaxtreeparser.h
     source/astree/xabstractsyntaxtreeparservariable.cpp
     source/astree/xabstractsyntaxtreeparservalue.cpp

     source/astree/xabstractasyntaxtreevariable.h
     source/astree/xabstractasyntaxtreevariable.cpp

     source/astree/xabstractsyntaxtreen.h
     source/astree/xabstractsyntaxtreearithmetic.h
     source/astree/xabstractsyntaxtreeplus.cpp
     source/astree/xabstractsyntaxtreeminus.cpp
     source/astree/xabstractsyntaxtreemulti.cpp
     source/astree/xabstractsyntaxtreediv.cpp
     source/astree/xabstractsyntaxtreecompare.h
     source/astree/xabstractsyntaxtreecompare.cpp
     source/astree/xabstractsyntaxtreevalue.h
     source/astree/xabstractsyntaxtreevalue.cpp
     source/astree/xabstractsyntaxtreeprint.h
     source/astree/xabstractsyntaxtreeprint.cpp
     source/astree/xabstractsyntaxtreelet.h
     source/astree/xabstractsyntaxtreelet.cpp
     source/astree/xabstractsyntaxtreeset.h
     source/astree/xabstractsyntaxtreeset.cpp
     source/astree/xabstractsyntaxtreeif.h
     source/astree/xabstractsyntaxtreeif.cpp
     source/astree/xabstractsyntaxtreeelse.h
     source/astree/xabstractsyntaxtreeelse.cpp
     source/astree/xabstractsynatxtreeblock.h
     source/astree/xabstractsynatxtreeblock.cpp
     source/astree/xabstractsyntaxtreebreak.h
     source/astree/xabstractsyntaxtreebreak.cpp
     source/astree/xabstractsyntaxtreereturn.h
     source/astree/xabstractsyntaxtreereturn.cpp
     source/astree/xabstractsyntaxtreebuilder.h
     source/astree/xabstractsyntaxtreebuilder.cpp
     source/astree/xabstractsyntaxtreebuilderimpl.h
     source/astree/xabstractsyntaxtreebuilderlet.cpp
     source/astree/xabstractsyntaxtreebuildervariable.cpp
     source/astree/xabstractsyntaxtreepunctuator.h
     source/astree/xabstractsyntaxtreevisitor.cpp
     include/xscript/xabstractsyntaxtree.h
     source/xabstractsyntaxtree.cpp
)

add_subdirectory(XScriptEditor)
add_subdirectory(demo)

